#ifndef _COLLATZ_HPP
#define _COLLATZ_HPP 1

#include<unistd.h>
#include<cstdio>
#include<sys/types.h>
#include<sys/wait.h>

void Collatz(size_t start){
    while(start!=1){
        int temp=start;
        if(start%2)start=3*start+1;
        else start/=2;
        int pid=fork();
        if(pid<0){
            perror("IDpool is empty");
            exit(-1);
        }else if(pid==0){
            printf("%d\n",temp);
            exit(0);
        }else{
            wait(0);
        }
    }printf("1\n");
}
#endif//COLLATZ_HPP
